package com.huawei.appgallery.agreementimpl.ui;

import android.view.KeyEvent;
import com.huawei.appgallery.agreementimpl.view.activity.AbstractBaseActivity;
import o.awg;
import o.axx;
import o.axx.d;
import o.aya;
import o.ayb;
import o.ayb.e;
import o.ayf;
import o.ayn;
import o.fiv;

public abstract class AbsBaseProtocolActivity extends AbstractBaseActivity implements axx {
    protected d ʻ;
    protected boolean ʼ = false;
    protected ayb ʽ;
    protected boolean ˊ;
    protected int ˋ;
    protected String ˎ;
    protected int ˏ;
    protected fiv ॱ = fiv.ॱ(this);
    protected String ᐝ;

    protected abstract String ˊ();

    protected abstract e ˎ();

    public void onDestroy() {
        super.onDestroy();
        if (this.ʽ != null) {
            this.ʽ.ॱ(this);
        }
    }

    public void ˊ(boolean z) {
        this.ʼ = true;
        ˎ(z);
    }

    public void ˎ(d dVar) {
        this.ʻ = dVar;
    }

    protected void onPause() {
        super.onPause();
        if (this.ˏ == 99 && !this.ʼ) {
            aya.ˎ().ˋ(this.ᐝ, e.TERMS.ordinal(), false);
            finish();
        }
    }

    public boolean onKeyUp(int i, KeyEvent keyEvent) {
        if (this.ʻ != null && this.ʻ.ॱ(i, keyEvent)) {
            return true;
        }
        if (keyEvent.getKeyCode() == 4) {
            ˎ(false);
        }
        return super.onKeyUp(i, keyEvent);
    }

    private void ˎ(boolean z) {
        awg.ˎ.ˋ(ˊ(), "doSignResult, isSigned: " + z + ", isSignForUser: " + this.ˊ);
        ayn.ˎ(this.ˎ, z);
        if (this.ˊ) {
            ayn.ˏ(this.ˎ, z);
            if (z) {
                new ayf(true).ˊ();
            }
        }
        aya.ˎ().ˋ(this.ᐝ, ˎ().ordinal(), z);
        finish();
    }
}
